$(document).ready(function() {
	shouldShowbottom();
	setColor();

	$("#nav_back").click(function() {
		back();
	});

	$("#nav_next").click(function() {
		nextStep();
	});


});
//判断编辑状态还是展示状态
function shouldShowbottom() {
	var showBottom = $("#static").val();
	var container = $("#container");
	var height = 0;
	if (showBottom == '') {
		height = $(window).height() - 47;
	} else {
		height = $(window).height();
	};
	container.height(height);
}
function setColor() {
		var colorIndex = parseInt($('#color').val()) - 1;

		var colors = ["rgb(252,219,40)", "rgb(163,123,173)", "rgb(183,217,8)", "rgb(242,175,169)"];
		var oBody = $(document.body);
		oBody.css('background-color', colors[colorIndex]);

		var aIconDiv = $("#container .icon_div");
		$("#container .icon_div").each(function() {
			$(this).css('background-color', colors[colorIndex]);
		});
	}
	//跳转到下一步
function nextStep() {
		var site_id = $('#site_id').val();
		var t_id = $('#t_id').val();
		var color = $('#color').val();
		window.location.href = "set_home_image?site_id=" + site_id + "&t_id=" + t_id + "&color=" + color;
	}
	//返回上个界面
function back() {
	window.history.back();
}